package com.hhl.test;

import com.alibaba.fastjson.JSONObject;
import com.hhl.menu.BaseButton;
import com.hhl.menu.ClickButton;
import com.hhl.menu.ComlexButton;
import com.hhl.menu.Menu;
import com.hhl.menu.ViewButton;
import com.hhl.util.HttpRequestUtil;
import com.hhl.util.WXURLUtil;
import com.hhl.util.WechatAccessToken;


/**
 * 大坪病案打印
 * 说明：<br>
 * <h1>创 建 人: hehailong   <br></h1>
 * 创建日期: 2017-11-13 下午4:43:51<br>
 * 需要的jar包:
 */
public class menutest2 {

	public static void main(String[] args) {
		ComlexButton appMenu = new ComlexButton();
		ViewButton webSetApp = new ViewButton();
		webSetApp.setName("免费咨询(患者)");
		webSetApp.setType("view");
		webSetApp.setUrl("http://hhl.easy.echosite.cn/OphiuxConsultationPlatform/#/deptList");
		
		
		ViewButton webSetApp1 = new ViewButton();
		webSetApp1.setName("个人中心(通用)");
		webSetApp1.setType("view");
		webSetApp1.setUrl("http://hhl.easy.echosite.cn/OphiuxConsultationPlatform/#/personaCenter");
		
//		ViewButton webSetApp2 = new ViewButton();
//		webSetApp2.setName("咨询记录(通用)");
//		webSetApp2.setType("view");
//		webSetApp2.setUrl("http://hhl.easy.echosite.cn/OphiuxConsultationPlatform/#/consultationRecord");
		
		ViewButton webSetApp2 = new ViewButton();
		webSetApp2.setName("病历查询");
		webSetApp2.setType("view");
		webSetApp2.setUrl("http://dpba.ophiux.com:8917/hospwechatmvc/medical-record/query-view");
		
		
		ViewButton webSetApp3 = new ViewButton();
		webSetApp3.setName("病历复印");
		webSetApp3.setType("view");
		webSetApp3.setUrl("http://dpba.ophiux.com:8917/hospwechatmvc/home/authorization");
		
		
		ViewButton webSetApp4 = new ViewButton();
		webSetApp4.setName("服务须知");
		webSetApp4.setType("view");
		webSetApp4.setUrl("http://dpba.ophiux.com:8917/hospwechatmvc/guidelines/guidelines-view");
		
		appMenu.setName("在线问诊");
		appMenu.setSub_button(new BaseButton[]{webSetApp,webSetApp1,webSetApp2});
		
		
		ComlexButton a = new ComlexButton();
		ClickButton aa = new ClickButton();
		aa.setKey("GYWM");
		aa.setName("关于我们");
		aa.setType("click");
		
		ViewButton aa1 = new ViewButton();
		aa1.setName("联系我们");
		aa1.setType("view");
		aa1.setUrl("http://wpa.qq.com/msgrd?v=3&uin=1414454875&site=oicqzone.com&menu=yes");
		
		ClickButton aa2 = new ClickButton();
		aa2.setKey("KEY_MZ_KNOW");
		aa2.setName("测试图文");
		aa2.setType("click");
		
		ClickButton aa3 = new ClickButton();
		aa3.setKey("KEY_RY_KNOW");
		aa3.setName("测试文本");
		aa3.setType("click");
		
		a.setName("联系我们");
		a.setSub_button(new BaseButton[]{aa,aa1,aa2,aa3});
		
		Menu menu = new Menu();
		menu.setButton(new BaseButton[]{webSetApp2,webSetApp3,webSetApp4});
		
		String btnJson = JSONObject.toJSONString(menu);
		
		System.out.println(btnJson);
		
		
		String token = WechatAccessToken.getAccessToken("wx394240ecef75c40a", "9a4c4cf7d9616541c117e2204afafe35").getToken();
		System.out.println(JSONObject.toJSONString(menu));
		
		
		JSONObject bbb = HttpRequestUtil.httpRequest(WXURLUtil.MENU_URL.replace("ACCESS_TOKEN", token), "POST", JSONObject.toJSONString(menu));
		System.out.println(JSONObject.toJSONString(bbb));
		
	}
	
}
